#!/usr/bin/env python
# -*- coding:utf-8 -*-

from handle.HandleBase import HandleBase


class HandleStaff(HandleBase):
    '员工信息处理类'
    def __init__(self, environ):
        from util.sqldata import ModelStaffInfo
        super(HandleStaff, self).__init__(environ)
        self._staff_info = ModelStaffInfo()

    def action_index(self):
        '默认页'
        pass

    def action_query(self):
        '根据条件查询员工信息'
        str_name = self._form.getvalue('name')
        str_popo = self._form.getvalue('popo')
        query = {}
        if str_name:
            query['name'] = str_name
        if str_popo:
            query['popo'] = str_popo
        record = self._staff_info.get_by_query_with_leader(query)
        self._view['record'] = record

    def action_all(self):
        '查询所有员工信息'
        record = self._staff_info.get_all_with_leader()
        self._view['record'] = record
